#include "PFile.h"

namespace Proton
{
	namespace Managers
	{
		PFile::PFile(path _filePath)
		{
			filePath = new path(_filePath);
			dataSize = 0; 
			pData = nullptr;
			owner = true;
		}

		PFile::PFile(const char* _filePath)
		{
			filePath = new path(_filePath);
			dataSize = 0; 
			pData = nullptr;
			owner = true;
		}

		PFile::PFile(path _filePath, char* _pData, bool _isDataOwner, size_t _dataSize)
		{
			filePath = new path(_filePath);
			pData = _pData;
			dataSize = _dataSize;
			owner = _isDataOwner;
		}

		PFile::PFile(const char* _filePath, char* _pData, bool _isDataOwner, size_t _dataSize)
		{
			filePath = new path(_filePath);
			pData = _pData;
			dataSize = _dataSize;
			owner = _isDataOwner;
		}

		PFile::~PFile()
		{
			if(owner)
				delete[] pData;

			delete filePath;
		}

		void PFile::setFilePath(const char* _filePath)
		{
			delete filePath;
			filePath = new path(_filePath);
		}

		void PFile::setFilePath(path _filePath)
		{
			delete filePath;
			filePath = new path(_filePath);
		}

		void PFile::setDataPtr(char* _pData)
		{
			pData = _pData;
		}

		void PFile::setDataSize(size_t _dataSize)
		{
			dataSize = _dataSize;
		}

	}
}